import http from '/@/serve/index';
import { formatQuery } from '/@/libs/utils/format';

const prefix = '/ncov/tasks/deleted';

/**
 * 获取已删除任务列表
 * @returns
 */
export const getTask = (page: number, pageSize: number) =>
  http.get(`${prefix}?${formatQuery({ page, pageSize })}`);

/**
 * 恢复已删除任务列表
 * @param taskId 任务id
 * @returns
 */
export const restore = (taskId: string) => http.put(`${prefix}/${taskId}/restoration`);

/**
 * 彻底粉碎任务
 * @param taskId 任务id
 * @returns
 */
export const deleteTask = (taskId: string) => http.delete(`${prefix}/${taskId}`);

/**
 * 批量恢复任务
 * @param taskList 任务id列表
 * @returns
 */
export const batchRestore = (taskIdList: Array<string>) =>
  http.post(`${prefix}/batchRestore`, taskIdList);

/**
 * 批量粉碎任务
 * @param taskList 任务id列表
 * @returns
 */
export const batchDelete = (taskIdList: Array<string>) =>
  http.post(`${prefix}/batchDelete`, taskIdList);
